<?php
/**
 * @author Tongle Xu <xutongle@gmail.com>
 * @copyright Copyright (c) 2003-2103 Jinan TintSoft development co., LTD
 * @license http://www.tintsoft.com/html/about/copyright/
 * @version $Id$
 */
namespace Leaps\Base;

/**
 * ActionEvent represents the event parameter used for an action event.
 *
 * By setting the [[isValid]] property, one may control whether to continue running the action.
 *
 * @author Tongle Xu <xutongle@gmail.com>
 * @since 4.0
 */
class ActionEvent extends Event
{
	/**
	 * 目前正在执行的操作
	 * @var Action the action currently being executed
	 */
	public $action;

	/**
	 * 操作的结果。事件处理程序可以修改这个属性改变操作的结果。
	 * @var mixed the action result. Event handlers may modify this property to change the action result.
	 */
	public $result;

	/**
	 * 是否继续运行。
	 * @var boolean whether to continue running the action. Event handlers of
	 * [[Controller::EVENT_BEFORE_ACTION]] may set this property to decide whether
	 * to continue running the current action.
	 */
	public $isValid = true;

	/**
	 * 构造方法
	 * @param Action $action 与该操作关联的动作事件。
	 * @param array $config name-value pairs that will be used to initialize the object properties
	 */
	public function __construct($action, $config = [])
	{
		$this->action = $action;
		parent::__construct($config);
	}
}
